#include <QtCore/QDateTime> // for QDateTime, QDate
#include <QtCore/QString> // for QString, QCharRef
#include <QtCore/QTextStream> // for QTextStream
-#include <QtCore/QtGlobal> // for foreach
+#include <QtCore/QtGlobal> // for qAsConst
#include "csv_util.h"
#include "defs.h"
* pre-read the file to know how many data lines we should be seeing,
* we take this cheap shot at the data and cross our fingers.
*/
- foreach(const QString& ogp, xcsv_file.epilogue) {
+ for(const auto& ogp : qAsConst(xcsv_file.epilogue)) {
if (ogp.startsWith(buff)) {
buff.clear();
break;
#include "defs.h"
#include <QtCore/QHash>
+#include <QtCore/QtGlobal>
#include <cerrno>
#include <cstdio>
#include <cstdlib>
static int
mmo_get_objid(const void* ptr)
{
- foreach(int key, objects.keys()) {
- if (objects.value(key)->data == ptr) {
- return key;
+ for (auto o = objects.constBegin(); o != objects.constEnd(); ++o) {
+ if (o.value()->data == ptr) {
+ return o.key();
}
}
return 0;
xfree(data->name);
}
if ((data->type == wptdata) && (data->refct == 0)) {
- delete(Waypoint*)data->data;
+ delete (Waypoint*)data->data;
}
xfree(data);
}
icons.clear();
- foreach(int k, objects.keys()) {
- mmo_free_object(objects.value(k));
+ for (auto value : qAsConst(objects)) {
+ mmo_free_object(value);
}
objects.clear();
mmo_rte = rte;
QUEUE_FOR_EACH(&rte->waypoint_list, elem, tmp) {
- Waypoint* wpt = reinterpret_cast<Waypoint *>(elem);
+ Waypoint* wpt = reinterpret_cast<Waypoint*>(elem);
QDateTime t = wpt->GetCreationTime();
if ((t.isValid()) && (t.toTime_t() < time)) {
time = t.toTime_t();
}
QUEUE_FOR_EACH(&rte->waypoint_list, elem, tmp) {
- Waypoint* wpt = reinterpret_cast<Waypoint *>(elem);
+ Waypoint* wpt = reinterpret_cast<Waypoint*>(elem);
int objid = mmo_get_objid(wpt);
gbfputuint16(objid & 0x7FFF, fout);
}
mmobjects.clear();
category_names.clear();
- foreach(int k, objects.keys()) {
- mmo_free_object(objects.value(k));
+ for (auto value : qAsConst(objects)) {
+ mmo_free_object(value);
}
objects.clear();